package com.ggjj.study.enums;

import java.util.function.Function;

/**
 * @auther ggjj
 * @create 2025-01-14 17:24
 */
public enum TrafficLightEnum
{
    RED(s -> "红灯"+s),     // RED("1","红灯"),
    YELLOW(s -> "黄灯"),
    GEEEN(s -> "绿灯");

    //2 构造
    private final Function<String, String> trafficLight;

    TrafficLightEnum(Function<String, String> trafficLight)
    {
        this.trafficLight = trafficLight;
    }

    public Function<String, String> getTrafficLight()
    {
        return trafficLight;
    }

    public static void main(String[] args)
    {
        System.out.println(TrafficLightEnum.RED);
        System.out.println(TrafficLightEnum.RED.getTrafficLight().apply("1"));
    }
}
